/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.pretorius.question3.ocp.model.impl;

import za.ac.cput.pretorius.question3.ocp.model.Device;

/**
 *
 * @author griddy
 */
public class SerialDevice implements Device{

    public SerialDevice(boolean state, String id, int baudRate) {
        this.state = state;
        this.id = id;
        this.baudRate = baudRate;
    }
    
    private boolean state;
    private String id; 
    private int baudRate;

    public int getBaudRate() {
        return baudRate;
    }

    public void setBaudRate(int baudRate) {
        this.baudRate = baudRate;
    }

    @Override
    public boolean changeState() {
         if(state)
         {
            state = false;
            return true;
         
         }
         else if (baudRate>9600)
         {
            state = true;
            return true;
         }
         else
             return false;
         
         
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public boolean getState() {
        return this.state;
    }

    @Override
    public void setId(String id) {
        this.id = id;
    }
    
}
